package client;

import interfaces.Core;
import interfaces.Product;


import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;


/*
 * This class is for testing basic communication
 */
public class JavaClientTestApl {
	public static void main( String[] args ) {
		//System.setProperty( "java.security.policy", "client.policy" );
		
		String url = "iiop://localhost:1060/";

		try {
			Context namingContext = new InitialContext();

			Core core = (Core)namingContext.lookup( url + "core" );
			for( Product product: core.getProductList().getProductList() ) {
				System.out.println( product.getName() );
			}
		} catch( NamingException e ) {
			System.out.println( "NamingError: " + e.getExplanation() ); 
		} catch( Exception e ) {
			System.out.println( "Error: " + e.getMessage() );
			e.printStackTrace();
		}
	}
}
